package file;

import java.io.File;

public class ListFileDemo {
    public static void main(String[] args) {
        File dir=new File(".");
        if(dir.isDirectory()){
            System.out.println("是目录");
            File[]subs=dir.listFiles();
            System.out.println("共"+subs.length+"个子项");
            for(File sun:subs){
                System.out.println(sun.getName());
            }
        }else {
            System.out.println("不是目录");
        }
    }
}
